<?php include "../config.php";?>
<?php
session_start();
?>
<!--/*验证码的session开始，如果不放在前面，有的服务器会出现警告*/-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="css/index.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="js/viewport.js"></script>
    <script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>

</head>

<body>

<div id="width_height">


    <script>
        function help(){
            alert('资料收集中！');
        }
    </script>

    <div class="gate_content">
<div id="logo">

<h5>注册</h5>
</div>


<div id="content_form">
<form id="registerform" name="registerform" method="post" action="registercheck.php" enctype="multipart/form-data"   onsubmit="return validateForm()">
    <ul>
        <li><label >账号</label>
            <input type="text" name="account" alt="账号" id="account" maxlength="12"  placeholder="6-12位英文或数字组合"/>
        </li>

        <li><label class="icon_2"></label>
            <input type="password" name="password" alt="密码"  id="password"  placeholder="密码长度为6-12位"/>
        </li>
        <li><label class="icon_2"></label>
            <input type="password" name="repassword" alt="二次密码" id="repassword" placeholder="再次输入密码"/>
        </li>


        <input type="submit" name="submit" id='submit' value="注 册"/>
    </ul>

<div class="item box">
    <div class="noaccount" > <a href="index.php"> 用户登录 </a></div>
</div>


</form>

	<ul id="foger_regist">
<!--	  <li>忘记密码</li>
	  <li>注册登录</li>-->
        <!--<li onclick="bangdingweixin()">绑定微信</li>-->
	</ul>
<script>
    function bangdingweixin(){
        alert("功能准备开发，敬请期待！")
    }
</script>

</div>
    </div>
</div>

<canvas id="Mycanvas"></canvas>
<script type="text/javascript" src="js/index_animation.js"></script>
<script type='text/javascript'>
    function validateForm(){
//        var msg ="不能为空";
//        $('form input').each(function(){
//            if(isEmpty($(this).val())){
//                alert($(this).attr('alt')+msg);
//                return false;
//            }
//        })
        if($("#phone").val().length < 6){
            alert("请输入6-12位的账号");
            return false;
        }
        if(isEmpty($("#name").val())){
            alert("单位名称不能为空");
            return false;
        }
        if(isEmpty($("#password").val())){
            alert("密码不能为空");
            return false;
        }
        if($("#password").val() != $("#repassword").val()){
            alert("二次密码不正确");
            return false;
        }
        if(!check_hone($("#phone").val())){return false;}
        if(!check_email($("#email").val())){return false;}
    }


    var sendYzm = false;
    function send_yzm(){
        if(sendYzm){return;}
        sendYzm = true;
        var phone = $("#phone").val();
        if(!check_hone(phone)){return false;}

        $.post("../backstage/login/register_yzm.php", { "phone" : phone} ,function(data){
            if(data.code == '1'){
                yzm_Interval();
            }else{
                sendYzm = false;
            }
            alert(data.msg);
        },'json');
    }

    function yzm_Interval(){
        var sendYzmTime = 5;
        var sendYzmVar = setInterval(function(){
            if(sendYzmTime == 0){
                clearInterval(sendYzmVar);
                sendYzm = false;
                $('#sendYzm').html("发送验证码");
            }else{
                $('#sendYzm').html("验证码发送中..."+ --sendYzmTime);
            }
        }, 1000);
    }

    function check_hone(phone){
        if(!(/^1[3456789]\d{9}$/.test(phone))){
            alert("手机号码有误，请重填");
            return false;
        }
        return true;
    }

    function check_email(email){
        var pattern = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        strEmail = pattern.test(email);
        if (!strEmail) {
            alert("邮箱有误，请重填");
            return false;
        }
        return true;
    }

    function isEmpty(obj){
        if(typeof obj == "undefined" || obj == null || obj == ""){
            return true;
        }else{
            return false;
        }
    }

</script>
</body>
</html>